package pl.netcoffee.android.finserDroid;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class RegisterCashPayment extends Activity{

	public void onCreate(Bundle sis){
		super.onCreate(sis);
		
		setContentView(R.layout.cashpayment);
		
		Button confirm = (Button)findViewById(R.id.paymentok);
		confirm.setOnClickListener(registerPayment);
		
		
		
	}
	
	protected void doRegister(){
		
		EditText kwota = (EditText)findViewById(R.id.cashPaymentAmount);
		String amount = kwota.getText().toString();
		
		EditText opis = (EditText)findViewById(R.id.cashPaymentDescription);
		String descr = opis.getText().toString();
		
		
		AppLogic app = AppLogic.getInstance(this);
		
		ServiceProvider serwis = app.getServiceProvider();
		
		ApiCommand commander = serwis.getCommand();
		
		commander.registerDefaultCashPayment(amount, descr);
		
		this.finish();
		
	}
	
	public OnClickListener registerPayment = new OnClickListener() {
		
		@Override
		public void onClick(View v) {

			doRegister();
			
		}
	};
	
}
